﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;

namespace YJKArch.Utils.Generics
{
	public class XYComparer : IComparer<XYZ>
	{
		public int Compare(XYZ lhv, XYZ rhv)
		{
			if (Geometry.IsEqual(lhv.Y, rhv.Y))
			{
				if (Geometry.IsEqual(lhv.X, rhv.X))
				{
					return 0;
				}
				if (Geometry.LessThan(lhv.X, rhv.X))
				{
					return -1;
				}
			}
			else if (Geometry.LessThan(lhv.Y, rhv.Y))
			{
				return -1;
			}
			return 1;
		}
	}
}
